package entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * 地址实体类
 */
public class Address implements Serializable {
    // 序列化版本号
    private static final long serialVersionUID = 1L;
    private int addId;
    // 用户id
    private int userId;
    private String receiverName;
    private String receiverPhone;
    private String receiverMobile;
    private String receiverState;
    // '城市'
    private String receiverCity;
    // '区/县'
    private String receiverDistrict;
    // 收货地址，如：xx路xx号'
    private String receiverAddress;
    // 邮政编码,如：310001
    private String receiverZip;
    // 是否为默认地址，1-true,0-false
    private boolean isDefault;
    // 地址状态，1-正常，0-删除
    private boolean status = true;
    // 修改时间
    private java.sql.Timestamp updated;
    // 创建时间
    private java.sql.Timestamp created;

    public Address() {
    }

    public Address(int addId, int userId, String receiverName, String receiverPhone, String receiverMobile, String receiverState, String receiverCity, String receiverDistrict, String receiverAddress, String receiverZip, boolean isDefault, boolean status, Timestamp updated, Timestamp created) {
        this.addId = addId;
        this.userId = userId;
        this.receiverName = receiverName;
        this.receiverPhone = receiverPhone;
        this.receiverMobile = receiverMobile;
        this.receiverState = receiverState;
        this.receiverCity = receiverCity;
        this.receiverDistrict = receiverDistrict;
        this.receiverAddress = receiverAddress;
        this.receiverZip = receiverZip;
        this.isDefault = isDefault;
        this.status = status;
        this.updated = updated;
        this.created = created;
    }

    public int getAddId() {
        return addId;
    }

    public void setAddId(int addId) {
        this.addId = addId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getReceiverName() {
        return receiverName;
    }

    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }

    public String getReceiverPhone() {
        return receiverPhone;
    }

    public void setReceiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
    }

    public String getReceiverMobile() {
        return receiverMobile;
    }

    public void setReceiverMobile(String receiverMobile) {
        this.receiverMobile = receiverMobile;
    }

    public String getReceiverState() {
        return receiverState;
    }

    public void setReceiverState(String receiverState) {
        this.receiverState = receiverState;
    }

    public String getReceiverCity() {
        return receiverCity;
    }

    public void setReceiverCity(String receiverCity) {
        this.receiverCity = receiverCity;
    }

    public String getReceiverDistrict() {
        return receiverDistrict;
    }

    public void setReceiverDistrict(String receiverDistrict) {
        this.receiverDistrict = receiverDistrict;
    }

    public String getReceiverAddress() {
        return receiverAddress;
    }

    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }

    public String getReceiverZip() {
        return receiverZip;
    }

    public void setReceiverZip(String receiverZip) {
        this.receiverZip = receiverZip;
    }

    // （是否为默认地址，1-true,0-false）
    public boolean getIsDefault() {
        return isDefault;
    }

    // （是否为默认地址，1-true,0-false）
    public void setIsDefault(boolean isDefault) {
        this.isDefault = isDefault;
    }

    // 地址状态，1-正常，0-删除）
    public boolean getStatus() {
        return status;
    }

    // 地址状态，1-正常，0-删除）
    public void setStatus(boolean status) {
        this.status = status;
    }

    public Timestamp getUpdated() {
        return updated;
    }

    public void setUpdated(Timestamp updated) {
        this.updated = updated;
    }

    public Timestamp getCreated() {
        return created;
    }

    public void setCreated(Timestamp created) {
        this.created = created;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Address address = (Address) o;
        return addId == address.addId && userId == address.userId && isDefault == address.isDefault && status == address.status && Objects.equals(receiverName, address.receiverName) && Objects.equals(receiverPhone, address.receiverPhone) && Objects.equals(receiverMobile, address.receiverMobile) && Objects.equals(receiverState, address.receiverState) && Objects.equals(receiverCity, address.receiverCity) && Objects.equals(receiverDistrict, address.receiverDistrict) && Objects.equals(receiverAddress, address.receiverAddress) && Objects.equals(receiverZip, address.receiverZip) && Objects.equals(updated, address.updated) && Objects.equals(created, address.created);
    }

    @Override
    public int hashCode() {
        return Objects.hash(addId, userId, receiverName, receiverPhone, receiverMobile, receiverState, receiverCity, receiverDistrict, receiverAddress, receiverZip, isDefault, status, updated, created);
    }

    @Override
    public String toString() {
        return "Address{" +
                "addId=" + addId +
                ", userId=" + userId +
                ", receiverName='" + receiverName + '\'' +
                ", receiverPhone='" + receiverPhone + '\'' +
                ", receiverMobile='" + receiverMobile + '\'' +
                ", receiverState='" + receiverState + '\'' +
                ", receiverCity='" + receiverCity + '\'' +
                ", receiverDistrict='" + receiverDistrict + '\'' +
                ", receiverAddress='" + receiverAddress + '\'' +
                ", receiverZip='" + receiverZip + '\'' +
                ", isDefault=" + isDefault +
                ", status=" + status +
                ", updated=" + updated +
                ", created=" + created +
                '}';
    }
}
